package com.lac.component.cas;

/**
 * @author xiaokuixiao
 * date2025/7/9 13:48
 */
import java.util.concurrent.atomic.AtomicInteger;

public class Counter {
    private AtomicInteger count = new AtomicInteger(0);

    public void increment() {
        // 使用 CAS 实现原子递增
        count.incrementAndGet(); // Internally uses CAS: count.compareAndSet(expect, next);
    }

    public int getCount() {
        return count.get();
    }
}
